package simpleExample;

import java.util.ArrayList;
import java.util.List;

import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.bpc.staticchecker.FrameInstance;

import fr.ema.arch3d.gea.mainGUI.DrawGraph;
import fr.ema.arch3d.model.architecture.Interface;
import fr.ema.arch3d.model.architecture.specification.ComponentRole;
import fr.ema.arch3d.model.architecture.specification.Connection;
import fr.ema.arch3d.model.architecture.specification.Specification;
import fr.ema.arch3d.model.consistencyChecker.NameConsistencyChecker;
import fr.ema.arch3d.model.consistencyChecker.SpecificationBehaviorConsistencyChecker;

public class clientSever {

    /**
     * Method description
     *
     * @param args
     * @throws NoSuchInterfaceException 
     * @throws InstantiationException 
     */
    public static void main(String[] args) throws InstantiationException, NoSuchInterfaceException {
	Interface cItf1=new Interface("cItf1", "example.log", true, false,new String[]{"findName1"});
	Interface cItf2=new Interface("cItf2", "example.log", true, false,new String[]{"findName2"});
	Interface sItf1=new Interface("sItf1", "example.log", false, false,new String[]{"findName1"});
	Interface sItf2=new Interface("sItf2", "example.log", false, false,new String[]{"findName2"});
	ComponentRole client=new ComponentRole("client",new Interface[]{cItf1,cItf2},"!cItf1.findName1*|!cItf2.findName2*");
	ComponentRole server1=new ComponentRole("server1",new Interface[]{sItf1},"?sItf1.findName1*");
	ComponentRole server2=new ComponentRole("server2",new Interface[]{sItf2},"?sItf2.findName2*");
	
	Connection cs1=new Connection("cs1", "cItf1", client, "sItf1", server1);
	Connection cs2=new Connection("cs2", "cItf2", client, "sItf2", server2);
	Specification spec=new Specification("clientServer");
	
	spec.insertConnection(cs1);	
	spec.insertConnection(cs2);
	spec.insertCmpRole(client);
	spec.insertCmpRole(server1);
	spec.insertCmpRole(server2);
	

	SpecificationBehaviorConsistencyChecker.check(spec);
	NameConsistencyChecker.check(spec, client);
	
	DrawGraph dg=new DrawGraph();
	dg.drawArch(spec, null, null);
    }

}
